Comparing patterns

ABSTRACT

A first image (or other pattern) is represented by a first ordered set of elements A each having a value and a second pattern is represented by a second such set. A comparison of the two involves performing, for each of a plurality of elements x of the first ordered set the steps of selecting ( 103 ) from the first ordered set a plurality of elements x′ in the vicinity of the element x under consideration, selecting ( 102 ) an element y of the second ordered set and comparing the elements x′ of the first ordered set with elements y′ of the second ordered set (each of which has the same position relative to the selected element y′ of the second ordered set as a respective one x′ of the selected plurality of elements of the first ordered set has relative to the element x under consideration). The comparison itself  106  comprises comparing the value of each of the selected plurality of elements x′ of the first set with the value of the correspondingly positioned element y′ of the like plurality of elements of the second set in accordance with a predetermined match criterion to produce a decision that the plurality of elements of the first ordered set matches the plurality of elements of the second ordered set. The comparison is them repeated with a fresh selection of the plurality of elements x′ of the first set and/or a fresh selection of an element y of the second ordered set generating a similarity measure V as a function of the number of matches. Preferably, following a comparison resulting in a match decision, the next comparison is performed with a fresh selection of the plurality of elements x′ of the first set and the same selection of an element y of the second set.

The present invention is concerned with comparing one pattern with another, and is of particular interest in the comparison of two-dimensional patterns such as visual images, although applicable also to one-dimensional patterns and patterns having three or more dimensions. Standard approaches to pattern recognition use templates to recognise and categorise patterns [1]. Such templates take many forms but they are normally produced by a statistical analysis of training data and matched with unseen data using a similarity measure [2]. The statistical analysis is normally carried out over a number of intuitively selected features that appear to satisfy the needs of the recognition task. For example, in speech recognition templates can be encapsulated as Hidden Markov Models derived in the frequency domain and in Optical Character Recognition the templates take the form of the character fonts themselves. In the case of face recognition a number of intuitively chosen features such as skin texture, skin colour and facial feature registration are used to define face templates. In a CCTV surveillance application intruders are normally detected through a process of frame subtraction and background template modelling which detects movement and removes background effects from the processing [3]. In many cases the number of features leads to a computationally unmanageable process and Principal Components Analysis and other techniques are used to scale down the problem without significantly reducing performance [http://www.partek.com/index.html]. These approaches achieve great success in non-noisy environments but fail when the pattern variability and number of pattern classes increase.

Some techniques for analysis of images or other patterns where the pattern is compared with other parts of the same pattern are described in our earlier patent applications as follows.

-   European patent application 00301262.2 (publication No. 1126411)     (applicants ref. A25904EP#); -   International patent application PCT/GB01/00504 (publication No. WO     01/61648) (applicants ref. A25904WO); -   International patent application PCT/GB01/03802 (publication No. WO     02/21446) (applicants ref. A25055WO); -   U.S. patent application Ser. No. 977,263/09 filed 16 Oct. 2001     (publication No. 20020081033) (applicants ref. A25904US1);     as well as the following papers published by the inventor: -   Stentiford F W M, “An estimator for visual attention through     competitive novelty with application to image compression”, Proc.     Picture Coding Symposium 2001, Seoul, 25-27 April, pp 101-104, 2001. -   Stentiford F W M, “An evolutionary programming approach to the     simulation of visual attention”, Proc. Congress on Evolutionary     Computation 2001, Seoul, pp 851-858, 27-30 May, 2001.

According to one aspect of the present invention there is provided a method of comparing a first pattern represented by a first ordered set of elements each having a value with a second pattern represented by a second ordered set of element each having a value, comprising performing, for each of a plurality of elements of the first ordered set the steps of:

(i) selecting from the first ordered set a plurality of elements in the vicinity of the element under consideration, the selected elements having, within the ordered set, respective mutually different positions relative to the element under consideration;

(ii) selecting an element of the second ordered set;

(iii) comparing the selected plurality of elements of the first ordered set with a like plurality of elements of the second ordered set each of which has within the second ordered set the same position relative to the selected element of the second ordered set as a respective one of the selected plurality of elements of the first ordered set has relative to the element under consideration, said comparison comprising comparing the value of each of the selected plurality of elements of the first ordered set with the value of the correspondingly positioned element of the like plurality of elements of the second ordered set in accordance with a predetermined match criterion to produce a decision that the plurality of elements of the first ordered set matches the plurality of elements of the second ordered set;

(iv) repeating said comparison with a fresh selection of the plurality of elements of the first ordered set and/or a fresh selection of an element of the second ordered set; and

(v) generating for the element under consideration a similarity measure as a function of the number of comparisons for which the comparison indicates a match.

Other aspects of the invention are defined in the claims.

Some embodiments of the present invention will now be described with reference to the accompanying drawings, in which:

FIG. 1 is a block diagram of an apparatus for performing the invention;

FIG. 2 is a diagram illustrating operation of the invention;

FIG. 3 is a flowchart of the steps to be performed by the apparatus of FIG. 1 in accordance with one embodiment of the invention; and

FIGS. 4 to 9 illustrates some images and numerical results obtained for them

FIG. 1 shows an apparatus consisting of a general purpose computer programmed to perform image analysis according to a first embodiment of the invention. It has a bus 1, to which are connected a central processing unit 2, a visual display 3, a keyboard 4, a scanner 5 (or other device, not shown) for input of images, and a memory 6.

In the memory 6 are stored an operating system 601, a program 602 for performing the image analysis, and storage areas 603, 604 for storing two images, referred to as image A and image B. Each image is stored as a two-dimensional array of values, each value representing the brightness of a picture element within the array.

The image arrays are shown schematically in FIGS. 2 a and 2 b. Image A consists of a 20×20 array of picture elements x=(x₁, x₂) where x₁ and x₂ are the horizontal and vertical positions of the elements within the image. Each element has a brightness represented by a respective value a=a (x). Similarly, the image B consists of a 20×20 array of picture elements y=(y₁, y₂) having brightness values b.

A method of image analysis performed by the program 602 is performed in accordance with the flowchart shown in FIG. 3. It has as its aim to generate a measure V of similarity between the images; more specifically, a high value of V indicates that image B contains visual material similar to the content of image A.

It is assumed that the images have width xmax₁ and ymax₁ and height xmax₂ and ymax₂, and the picture element co-ordinates are x₁=0 . . . xmax₁−1, x₂=0 . . . xmax₂−1.

In Step 100, a picture element x in image A is selected. They can be dealt with in any order, but it is convenient to select initially the element x=(ε,ε) and on subsequent iterations, successive elements in raster-scan fashion, until all have been dealt with, except for those within ε of the edge of the image i.e. up to (xmax₁−ε31 1, xmax₂−ε−1).

In Step 101, the score V and a counter tries are set to zero.

In Step 102, an element y=(y₁, y₂) is chosen at random from image B, within a maximum distance s of the position of x, that is |x _(i) −y _(i) |≦s for all i

This limitation, which is optional, is represented in FIG. 2 b by the dotted square S. It improves efficiency if it is known that corresponding objects in the two images will not be shifted in position by more than s picture elements in either co-ordinate direction: in effect, s represents the maximum misregistration or local distortion between the two images.

The selection of y is also subject to the restriction that it is located no more than ε from the edge of the image, i.e. ε≦y _(i) ≦ymax_(i)−ε−1 for i=1,2

where ymax_(i) is the width or height of the image in picture elements (20 in this example).

In Step 103, a set S_(x) of picture elements x′, are selected, comparing the element plus at least one further element, m in number, randomly selected from image A, in the neighbourhood N of picture element x, where the neighbourhood N is a 2ε+1×2ε+1 square centred on x. That is, an element x′=(x₁′, x′₂) lies within N if |x _(i) ′−x _(i)|<ε for all i

We prefer that the neighbourhood set S_(x) includes the element x itself, although this is not actually essential. A neighbourhood set S_(y) is then defined in image B, with m+1 elements y′=(y₁′, y₂′) each of which has the same position relative to element y as the corresponding element x′ of S_(x) has from x, that is y _(i) ′−y _(i) =x _(i) ′−x _(i) for all i

(The reason for the edge restrictions mentioned above is of course to avoid choosing a neighbourhood which extends outside the image area). In Step 104, the counter tries is incremented, and in Step 105 its value is checked so see whether sufficient comparisons have been performed.

Assuming for the present that this is not the case, then at Step 106 the two sets S_(x), S_(y) are compared. If the difference between the value of an element x′ of the set S_(x) and the value of the correspondingly positioned element x′ of the set S_(y) is less than a threshold δ, i.e. |a( x ′)−b( y ′)|<δ

then the two elements are considered to match. The two sets are considered to match only if every element x′ of the set S_(x) matches the corresponding element y′ of the set S_(y).

If the sets do not match, the element y is discarded as a candidate for further comparisons and the process resumes at step 102 with a fresh point y being chosen. If on the other hand, they match, then y is retained for a further iteration. Ignoring Step 107, for the present, the process proceeds with step 108 where the score V is incremented. Different neighbourhood sets are then generated at Step 103 and the process repeated from that point.

When, at Step 105, the count tries of the number of comparisons exceeds a threshold, the process for the current x is terminated: at Step 109 the value of V is stored in the memory 6 and then, at step 110, a check is performed as to whether all points x have been dealt with. If so, then firstly the average score Va (being the average of all the individual scores V for the picture elements x in image A) is calculated at Step 111 and the process terminated at 112; otherwise the whole process is repeated from Step 100 for a fresh point x.

The threshold value used at Step 105 could be set to a desired number of comparisons t, and Step 107 omitted. In practice, however, we find that the early comparisons often do not find a match, but once a match is found a significant number of different neighbourhood sets show matches with the same y. In the interests of providing a score V which is easily interpreted, the first few iterations are not scored; the process as shown includes a test 107 which prevents the score being incremented during the first init comparisons. The threshold used at Step 105 is thus increased by init so that the maximum potential score is t. In this way, we find that the chances of obtaining a high or maximum score for images which are very similar or identical is greatly increased.

Specific values for the various parameter used in tests were as follows:

-   Image A size xmax₁×xmax₂: 20×20 -   Image B size xmax₁×xmax₂: 20×20 -   Neighbourhood parameter ε: 4 -   Neighbourhood set size m: 3 -   Maximum A−B shift s: 7 -   Number of comparisons t: 50 -   Initial comparisons init: 20

Naturally, for higher definition images, correspondingly larger values of ε and s would be chosen. The values of t and init have to be increased as s increases in order to obtain equally reliable and statistically significant results.

The results of these tests are given later; where the parameters used differ from those quoted above, this is noted.

It will be seen that the score of a picture element x in the pattern A is high if many randomly selected S_(x) match S_(y) for a given y in pattern B. It is worth noting that the Visual Attention score (discussed in our earlier patent applications) of picture element x in pattern A is high if S_(x) mis-matches S_(y) where y is not held but is randomly selected from pattern A. Whereas Visual Attention requires no memory save the single image A, the present method requires also the information contained in pattern B to detect commonality.

A location x will be worthy of cognitive attention if a sequence of t neighbourhood sets S_(x) matches a high proportion of the same neighbourhoods surrounding some y in pattern B. In FIG. 2, m=3 picture elements x′ are selected in the neighbourhood of a picture element x in pattern A and matched with 3 picture elements in the neighbourhood of picture element y in pattern B. Each of the picture elements might possess three colour intensities, so a=(a_(r),a_(g),a_(b)) and the neighbourhood set of the second picture element y matches the first if the colour intensities of all m+1 corresponding picture element have values within δ of each other. Picture elements x in A that achieve large numbers of matches over a range of t neighbourhood sets S_(x) with neighbourhood sets S_(y) around y in B are assigned a high score. This means that neighbourhood sets in A possessing structure present in B will be assigned high scores.

Some image analysis techniques carry out comparison calculations between images using patches that are neighbourhoods in which all the picture elements are employed. Patches match when a measure of correlation exceeds a certain threshold. This approach is unable to make best use of detail that is smaller than the size of the patch except in the case in which the correlation measure is designed to identify a specific texture. The random picture element neighbourhoods S_(x) used in this method do not suffer from this disadvantage.

The gain of the scoring mechanism is increased significantly by retaining the picture element location y if a match is detected, and re-using y for comparison with the next of the t neighbourhood sets. It is likely that if a matching picture element configuration is generated, other configurations will match again at the same point, and this location y once found and re-used, will accelerate the rise of the score provided that the sequence is not subsequently interrupted by a mismatch.

If, however, S_(x) subsequently mismatches at that location, the score is not incremented, and an entirely new location y in pattern B is randomly selected ready for the next comparison. In this way competing locations in pattern B are selected against if they contain little commonality with the neighbourhood of x in pattern A.

Some possible variations will now be discussed.

a) It is not essential that all picture elements x be analysed: thus, if desired, a subset—perhaps on a regular grid—could be chosen.

b) The above method assumes single (brightness) values for the picture elements. In the case of colour images, the images could firstly be converted to monochrome. Alternatively, if each picture element is expressed as three values, such as red, green and blue, or luminance plus colour difference, then the test for a match would involve consideration of the distance between the element values in 3 dimensions. For example, if the colour component values are a=(a_(r), a_(g), a_(b)), b=(b_(r), b_(g), b_(b)) for the two image then the criterion for a match might be (a_(r)−b_(r))<δ and |a_(g)−b_(g)|<δ and |a_(b)−b_(b)|<δ. See below for further discussion of distance measures.

c) The strategy of choosing y at random could be modified by providing that when a element x=(x₁, x₂) produces a high score V against element y, and an adjacent element x (e.g. (x₁+1, x₂)) is to be dealt with, then the first element y to be selected in image B could be the correspondingly adjacent element (i.e. (y₁+1, y₂)). Further selections of y would be random, as before. In the event that the high score for element x was produced as a result of comparisons with more than one y, then one would choose the element adjacent to whichever y made the largest contribution to the high score. To implement this is would be necessary to track, temporarily, the coordinates of the different picture elements y and their partial scores.

d) The process need not necessarily be carried out for the whole image. For example, if a region of image A has been identified as being of special interest—perhaps using the method described in one of our earlier patent applications referred to above—then the picture elements x dealt with may be just those lying within the identified region.

References here to random selection include the possibility of selection using a pseudo-random process.

The method is not applicable solely to images, or even three-dimensional patterns, but can be used for any ordered set of values in 1, 2, 3 or more dimensions.

More generally, suppose that one wishes to generate a measure of the similarity between two patterns A and B, where both the patterns and the individual pattern of values within a pattern may have 1, 2 or more dimensions.

Let a set of measurements a on pattern A correspond to a location x in A in bounded n-space (x₁, x₂, x₃, . . . , x_(n)) where

-   -   x=(x₁,x₂,x₃, . . . , x_(n)) and a=(a₁,a₂,a₃, . . . , a_(p))

Define a function F such that a=F(x) wherever a exists. It is important to note that no assumptions are made about the nature of F e.g. continuity. It is assumed that x exists if a exists.

Consider a neighbourhood N of x where { x′ε N iff|x _(i) −x′ _(i)|<ε_(i) ∀i}

Select a set of m+1 random points S_(x) in N where

-   -   S_(x)={x′₁, x′₂, x′₃, . . . , x′_(m)} and F(x′_(i)) is defined.

where however one of the x′ is preferably constrained to equal x. It is not found in practice to be necessary to constrain the random selection to avoid selection of the same point twice: i.e. the x′_(i) need not be distinct. Indeed, the x′_(i) could all be coincident with x or x′₁.

Select a location y corresponding to the set of measurements b on pattern B for which F is defined.

Define the set S_(y)={y′₁, y′₂, y′₃, . . . , y′_(m)} where

-   -   x−x′_(i)=y−y′_(i) and F(y′_(i)) exists.

The neighbourhood set S_(x) of x is said to match that of y if |F _(j)( x )−F _(j)( y )|<δ_(j) and |F _(j)( x′ _(i))−F _(j)( y′ _(i))|<δ_(j) ∀ ij.

In general δ_(j) is not a constant and will be dependent upon the measurements under comparison i.e. δ_(j) =f _(j)( F ( x ), F ( y ))

-   -   j=1 . . . p

Note that for some problems rather than defining a match as requiring the individual components a_(j)=F_(j)( ) and b_(j)=F_(j)( ) to match one might prefer to apply a threshold to the vector distance between a and b such as the city block distance. $\sum\limits_{j}{{a_{j} - b_{j}}}$

or the Euclidean distance $\sqrt{\left\{ {\sum\limits_{j}\left( {a_{j} - b_{j}} \right)^{2}} \right\}}$

The operation of the method described in the flowchart of FIG. 3 will be illustrated by the following test results.

In the tests, 20×20 black and white images were used (i.e. the values of a and b were always either 0 or 1). The tests however differ from the earlier description in that only black picture elements are scored—that is, the match criterion is not merely that |a−b|<δ but that a=b=1.

In each case the accompanying Figure shows a first image A, plus several second images B with which the first was compared, marked B1, B2 etc. (in once case two first images A1, A2 are compared with one image B). The coordinates x₁, y₁ 30are measured from left to right and the coordinates x₂, y₂ from top to bottom. Each of the second images is marked with the average score Va. Some Figures show a three-dimensional plot of the individual scores V over the image area: in each case the right-hand axis represents the horizontal axis of the mark and the front axis represents the vertical axis of the image. The vertical axis of the plot represents the value of V (in the embedded recognition case of Example 2, and 50−V in the other cases).

EXAMPLE 1 Optical Character Recognition (FIG. 4)

An image A of the letter B is compared with images B1-B5, of the letters A, B, C, D and E. The rank ordered average scores Va correspond to B, D, E, C, A. The results were generated with t=50, s=3 and ε=2.

EXAMPLE 2 Embedded Recognition (FIG. 5)

An image A of an ‘X’ shape is compared with another image B1 containing 9 smaller shapes including an ‘X’. The ‘X’ shape is again compared with image B2 with the same 9 shapes except for the small ‘X’ which is altered. The average scores V_(a) are 27.5 and 11.9 respectively, indicating the presence of ‘X’ features in the first and less in the second. The individual scores V for the respective comparisons are shown in the charts. The results were generated with t=50, s=7 and ε=2. A more complicated example of embedded recognition is the identification of known faces in a crowd of people.

EXAMPLE 3 Trade Mark Retrieval (FIG. 6)

An image A of a special cross shape is first compared with 4 basic shapes B1-B4 including a large cross, each basic pattern representing clusters of similar shapes with high scores between each other. The large cross generates the largest average score V_(a) (43.6). The same special cross in then compared with 4 varieties of cross B5-B8 including a small version of itself (B5) which obtains a maximum score of 50. The chart provides the values of (50−V) for each picture element in the comparison with the large cross—the tall columns indicate the disparity with the ends of the lower legs of the cross. The results were generated with t=50, s=7 and ε=2.

EXAMPLE 4 Fingerprint Recognition (FIG. 7)

More complex patterns, some possessing a great deal of similar material, are able to be distinguished and retrieved as in the trade mark example. A simplified arch A matches best with a representative arch B4 (49.3), and then with an identical pattern (49.9) amongst other arches. The chart provides the values of (50−V) for each picture element in the comparison with the representative arch pattern—the tall columns indicate the disparity with the ridge ends and on the border. The results were generated with t=50, s=3 and ε=2.

EXAMPLE 5 Face Recognition (FIG. 8)

Although the data is extremely simplified, this example illustrates an implementation of face recognition. A face A is matched with 4 representative faces B1-B4 and then with 4 faces in a sub-cluster B5-B8 represented by the best fitting representative face B2 (45.7). The best fit is with a non-identical face B7 in the sub-cluster (49.6). The chart provides the values of (50−V) for each picture element in the comparison with the 2^(nd) closest pattern B6 (48.2)—the tall columns indicate the disparity in the mouth region. The results were generated with t=50, s=3 and ε=2.

EXAMPLE 6 Surveillance (FIG. 9)

This example illustrates how intruders might be detected against a variable background. A pattern A1 representing a moving cloud, tree and fence obtains a high average score V_(a) (48.0) against a standard background B, but a version (A2) with an intruder present obtains a much lower score (33.1). The chart provides the values of (50−V) for each picture element in the intruder image (33.1)—the tallest columns indicate the location of the intruder. The results were generated with t=50, s=3 and ε=2.

This method carries out an analysis of two images that identifies perceptually significant common features and differences without being affected by scale differences, and by local relative distortions and translations. This means that it can be applied to recognition problems in which the object to be recognised is embedded in another image. It also means that images may be categorised according to the measure of feature similarity with each other and these values used to define a multi-class recognition system and a Query By Example retrieval system. By the same token the method may be used to detect dissimilarities as in the case of intruder detection or forgery detection. It may be used to detect disparities between images to detect motion or parallax. It does not necessarily rely upon prior knowledge of the content of the images and no training process is necessary. The algorithm is eminently suitable for parallel implementation.

Various advantages of the methods we have described will now be discussed.

Pattern Recognition

Standard approaches to pattern recognition require large numbers of representative patterns from all classes in order to satisfy the requirements of the training process for the classifier. Such classifiers will still fail if the features selected do not characterise unseen patterns not represented properly in the training set. This method requires no training set, save the two images under comparison.

It is normal for pattern recognition techniques to make special provision for scale differences between the patterns being classified. Such differences in the visual domain can arise because of perspective and other factors and it is common for prior knowledge to be incorporated in the classifier to compensate. This is not necessary in this method, provided that ε is not too large.

Another advantage is the ability to identify patterns embedded within larger data structures without suffering from exponentially growing computational demands or the effects of noise. This method therefore has application to the problem of detecting copyright infringement where portions of material have been cropped from larger works (of art, for example), and the task of reducing the size of databases where it is known that duplication is prevalent. It also has direct application to the problem of identifying scene-of-crime fingerprints where only a part of the total print is available for matching. In the case of facial recognition the method lends itself to searches based upon restricted portions of the unknown face. This means, for example, that searches can be carried out purely on the basis of the eye and nose region in cases where beards and moustaches might lead to ambiguity.

Unless provision is made for specific pattern content, the standard template approaches to pattern recognition fail when the patterns under comparison differ because of local distortions or small movements, as would be the visual case with rustling trees, moving clouds, changes in facial expression, scene-of-crime fingerprints on irregular surfaces, or noise, for example. Such provision requires prior knowledge of the application and will still cause the system to fail if the unseen pattern distortions do not conform to the system design requirements. This method is able to ignore the effects of local distortions without prior knowledge of the type of distortion.

The method may be applied to patterns of any dimension, such as one-dimensional audio signals, three dimensional video data (x,y,time), or n-dimensional time dependent vectors derived from any source such as sensor arrays. In the case of speech recognition it is able to handle variations in the speed of the speech without the use of special heuristics. A conventional approach uses Dynamic Time Warping to overcome this problem, but invokes greater computational effort and the danger of the warping process leading to increased misclassifications especially in a large multi-class problem. Furthermore portions of utterances would be sufficient for word identification using this invention if they were unique in the domain of discourse (e.g. ‘yeah’ instead of ‘yes’, missing the final sibilant).

This method deals with these problems by measuring the score of neighbourhoods in each image. Whereas a picture element is important within a single image if its neighbourhood is significantly different from most other parts of the same image (as discussed in our earlier patent applications mentioned above), it is cognitively important if its neighbourhood is significantly similar to that in a neighbourhood in the second image. The effects of mis-registration and local distortions are considerably reduced as the scores are not affected within certain limits.

The scores can be used to cluster groups of patterns possessing high scores relative to each other. Representative patterns taken from each cluster may themselves be clustered to form super-clusters and the process continued to structure very large pattern databases. Query-By-Example retrieval can be carried out by measuring the scores to each of the top level representative patterns and then to each of the representative patterns in sub-clusters corresponding to the highest scoring representative pattern in the previous cluster. It is likely that some representative patterns will represent overlapping clusters containing patterns which happen to possess high scores with those representative patterns. The method may be used in combination with a visual attention mechanism to rapidly define an area of interest in the pattern and then derive scores between this restricted area and a set of reference patterns (B patterns). In an aviation context a flying object might be quickly detected using visual attention and subsequently computed scores would reveal whether the object was likely to be a bird or a plane.

Disparity Detection

Standard approaches to disparity detection rely heavily upon accurate registration between two images so that the subtraction (which may be carried out piecewise for a small areas of the total image) takes place between picture elements that correspond to the same points on the original object pictured in the two images. The resulting difference-image highlights those areas that correspond to differences in the original images. This becomes extremely difficult if noise is present as uncertainty is introduced into the estimate of the correct registration position and many spurious differences can be generated as a result.

Even if noise is absent local distortions or slight subject movements will cause misregistration and areas of difference will be highlighted which are of little interest unless the distortion or movement itself is being measured. Linear or non-linear digital image registration techniques prior to subtraction partially compensates but does not eliminate this problem in a large proportion of cases [4].

A severe problem faced by conventional methods arises from the different conditions under which the two images were created. Such differences may stem from the lighting, weather conditions, a slightly different viewpoint, a different make of film, or a different camera with a different optical system. These interferences all contribute towards the generation of spurious differences between the images that do not relate to the content.

Differences between the two images caused by the conditions of image capture will be factored out by this method because such differences will affect the score equally across all parts of the image and will not disturb the rank ordering of the individual scores. Significant illumination differences between the two images are compensated by employing a larger threshold for the picture element matching (δ_(j) see above). This would be necessary, for example, if X-ray exposure times were different between the two images.

This method also has the advantage of being able to detect multiple disparities in which image A is compared with images B1,B2,B3 etc. This would be useful in the case of CCTV intruder detection in which image frames B1,B2,B3 etc would be typical examples of different atmospheric conditions and other normal background states, and an alarm would be raised only if disparities were detected in all the normal image frames.

It will be seen that these methods have relevance to almost all applications requiring pattern recognition:

Face recognition, fingerprint recognition, OCR, image retrieval, trademark identification, forgery detection, surveillance, medical diagnosis, and others.

They are particularly relevant to the medical industry where the comparison of very variable and noisy images is necessary to track the progress of medical conditions. For example, the identification of likely cancerous growth in mammograms is often gleaned from X-rays taken at different times and any automatic assistance would increase radiologist's throughput. In another example, contrast enhancement is normally obtained by subtracting the X-ray image of the normal breast from one taken after contrast injection and obtaining proper registration is not only difficult to obtain but is critical to the success of the process. The methods we have described can provide a clearer result without the attendant registration problems.

Advanced software detection systems for mammograms (eg. http://www.r2tech.com/prd/) are quite capable of spotting specific features commonly associated with cancer (eg microcalcifications), but the problem of temporal comparisons is largely not addressed.

REFERENCES

-   [1] Vailaya A et al., Image Classification for Content-Based     Indexing, IEEE Trans on Image Processing, Vol 10, No 1, pp 117-130,     January 2001. -   [2] Santini S & Jain R, Similarity Matching, in Proc 2^(nd) Asian     Conf on Computer Vision, pages II 544-548, IEEE, 1995. -   [3] IEEE Trans PAMI—Special Section on Video Surveillance, vol 22 No     8, August 2000. -   [4] Brown L G, A survey of image registration techniques, ACM     Computing Surveys, Vol. 24, No. 4 (December 1992), pp. 325-376. 

1. A method of comparing a first pattern represented by a first ordered set of elements each having a value with a second pattern represented by a second ordered set of element each having a value, comprising performing, for each of a plurality of elements of the first ordered set the steps of: (i) selecting from the first ordered set a plurality of elements in the vicinity of the element under consideration, the selected elements having, within the ordered set, respective mutually different positions relative to the element under consideration; (ii) selecting an element of the second ordered set; (iii) comparing the selected plurality of elements of the first ordered set with a like plurality of elements of the second ordered set each of which has within the second ordered set the same position relative to the selected element of the second ordered set as a respective one of the selected plurality of elements of the first ordered set has relative to the element under consideration, said comparison comprising comparing the value of each of the selected plurality of elements of the first ordered set with the value of the correspondingly positioned element of the like plurality of elements of the second ordered set in accordance with a predetermined match criterion to produce a decision that the plurality of elements of the first ordered set matches the plurality of elements of the second ordered set; (iv) repeating said comparison with a fresh selection of the plurality of elements of the first ordered set and/or a fresh selection of an element of the second ordered set; and (v) generating for the element under consideration a similarity measure as a function of the number of comparisons for which the comparison indicates a match.
 2. A method according to claim 1 in which the plurality of elements of the first ordered set includes the element under consideration.
 3. A method according to claim 1 in which the selection of the plurality of elements of the first ordered set is random or pseudo-random.
 4. A method according to claim 1 in which the selection of an element of the second ordered set is random or pseudo-random.
 5. A method according to claim 1 in which, following a comparison resulting in a match decision, a further comparison is performed with a fresh selection of the plurality of elements of the first ordered set and the same selection of an element of the second ordered set.
 6. A method according to claim 1 in which, following a comparison resulting in a decision that there is no match, a further comparison is performed with a fresh selection of an element of the second ordered set and the same selection of the plurality of elements of the first ordered set.
 7. A method according to claim 1, in which each value comprises a plurality of components.
 8. A method according to claim 1, in which the comparison is performed a predetermined number of times.
 9. A method according to claim 1, in which the similarity measure is a function of the number of comparisons for which the comparison indicates a match, excluding an initial number of comparisons.
 10. A method according to claim 1 in which, when an element under consideration has resulted in a similarity measure indicative of a large number of matches and a further element of the first ordered set is to be considered, the first selection of an element of the second ordered set for comparison therewith is of that element of the second ordered set whose position, within the second ordered set, relative to an element of the second ordered set giving rise to said large number of matches, is the same as the position of the further element of the first ordered set relative to the previous element under consideration. 